$(document).ready(function() {
	
	var $itemPic=$('div.index-row2-item img');
	var $page=$('.pagination');
	var picOffset=$itemPic.width()*1/2;
	var pageOffset=$page.width()*1/2;
	$itemPic.css({
		marginLeft: -picOffset+'px'
	});
	$page.css({
		marginLeft: -pageOffset+'px'
	});
	$('div.index-pro-wrapper').hover(function() {
		var $slidePar=$(this).find('p');
		$slidePar.stop();
	 	$slidePar.slideToggle();
	 });

	$('#index-carousel').hammer().bind('swipeleft', function(e) {
		$(this).carousel('next');
	});
	$('#index-carousel').hammer().bind('swiperight', function(e) {
		$(this).carousel('prev');
	});
	
	$('.hy-submit').click(function(e){
		e.preventDefault();
		var name=($('input[name=name]').val());
			var email=($('input[name=email]').val());
			var phone=($('input[name=phone]').val());
			var content=($('textarea[name=content]').val()); 
			$.post('/forms/submit.html',{ name:name,content:content,phone:phone,email:email},function(result){
				if(result.error==0)
				{
				  alert(result.content);
				  window.location.href='/index.html';
				}
				else
				{
					alert(result.content);
				}
		
				},'json');
	});
	
	$('.hy-js-search').click(function(e){
		e.preventDefault();
		var key=($('input.hy-js-searchtxt').val());
		 window.location.href='/s/'+key+'/article_1.html';
	});
});